import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/entry/index.vue'

import SysLayout from '@/layout/system/index.vue'

import SystemRoutes from './systems'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '',
          name: 'home',
          component: () => import('@/views/home/index.vue')
        }
      ]
    },
    {
      path: '/zhaopin',
      component: Layout,
      children: [
        {
          name: 'zhaopin',
          path: '',
          component: () => import('@/views/zhaopin/index.vue')
        },
        {
          name: 'zhaopinDetail',
          path: 'detail',
          component: () => import('@/views/zhaopin/detail.vue')
        }
      ]
    },
    {
      path: '/shop',
      component: Layout,
      children: [
        {
          name: 'shop',
          path: '',
          component: () => import('@/views/shop/index.vue')
        },
        {
          name: 'shopDetail',
          path: 'detail',
          component: () => import('@/views/shop/detail.vue')
        }
      ]
    },
    {
      path: '/news',
      component: Layout,
      children: [
        {
          name: 'news',
          path: '',
          component: () => import('@/views/news/index.vue')
        },
        {
          name: 'newsDetail',
          path: 'detail',
          component: () => import('@/views/news/detail.vue')
        }
      ]
    },
    {
      path: '/house',
      component: Layout,
      children: [
        {
          name: 'house',
          path: '',
          component: () => import('@/views/house/index.vue')
        },
        {
          name: 'houseDetail',
          path: 'detail',
          component: () => import('@/views/house/detail.vue')
        }
      ]
    },
    {
      path: '/rentout',
      component: Layout,
      children: [
        {
          name: 'rentout',
          path: '',
          component: () => import('@/views/rentout/index.vue')
        },
        {
          name: 'rentoutDetail',
          path: 'detail',
          component: () => import('@/views/rentout/detail.vue')
        }
      ]
    },
    {
      path: '/product',
      component: Layout,
      children: [
        {
          name: 'product',
          path: '',
          component: () => import('@/views/product/index.vue')
        },
        {
          name: 'Productdetail',
          path: 'detail',
          component: () => import('@/views/product/detail.vue')
        }
      ]
    },
    {
      path: '/scene',
      component: Layout,
      children: [
        {
          name: 'scene',
          path: '',
          component: () => import('@/views/scene/index.vue')
        },
        {
          name: 'sceneDetail',
          path: 'detail',
          component: () => import('@/views/scene/detail.vue')
        }
      ]
    },
    {
      path: '/explore',
      component: Layout,
      children: [
        {
          name: 'explore',
          path: '',
          component: () => import('@/views/explore/index.vue')
        },
        {
          name: 'exploreDetail',
          path: 'detail',
          component: () => import('@/views/explore/detail.vue')
        }
      ]
    },
    {
      path: '/about',
      component: Layout,
      children: [
        {
          name: 'about',
          path: '',
          component: () => import('@/views/about/index.vue')
        }
      ]
    },
    {
      path: '/systems',
      component: SysLayout,
      meta: {
        title: '数据管理',
        show: true
      },
      children: SystemRoutes
    }
  ]
})

export default router
